package com.ego.order.client;

import com.ego.pojo.Sku;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @author Ares
 * @date 2020-12-11
 */
@FeignClient("ItemService")
@RequestMapping("/goods")
public interface GoodsClient {

    @GetMapping("/skuList")
    ResponseEntity<List<Sku>> querySkuListByIds(@RequestParam("ids") List<Long> skuIdList);

    @PostMapping("/descrementStock")
    ResponseEntity<Void>  descrementStock(@RequestBody Map<Long, Integer> stockData);

    @GetMapping("/sku/{id}")
    ResponseEntity<Sku> querySkuById(@PathVariable("id") Long skuId);

    /**
     * 减秒杀库存
     */
    @PostMapping("stock/seckill/decrease/{skuId}")
    ResponseEntity<Void> decreaseSeckillStock(@PathVariable("skuId") Long skuId);
}
